/**
 * 页面通用混入
 * 用于统一页面行为，包括页面生命周期事件派发
 */

export default {
	onLoad() {

		uni.$emit("page-load", this);
	},

	onShow() {
		uni.$emit("page-show", this);
	},

	onHide() {
		uni.$emit("page-hide", this);
	},

	onUnload() {
		uni.$emit("page-unload", this);
	},

	onPullDownRefresh() {
		uni.$emit("page-pull-down-refresh", this);
	},

	onReachBottom() {
		uni.$emit("page-reach-bottom", this);
	},

	onTabItemTap(item) {
		uni.$emit("page-tab-item-tap", {
			page: this,
			item
		});
	},

	onNavigationBarButtonTap(e) {
		uni.$emit("page-nav-button-tap", {
			page: this,
			e
		});
	},

	onBackPress(e) {
		uni.$emit("page-back-press", {
			page: this,
			e
		});
	},

	onNavigationBarSearchInputChanged(e) {
		uni.$emit("page-search-input-changed", {
			page: this,
			e
		});
	},

	onNavigationBarSearchInputConfirmed(e) {
		uni.$emit("page-search-input-confirmed", {
			page: this,
			e
		});
	},

	onNavigationBarSearchInputClicked() {
		uni.$emit("page-search-input-clicked", this);
	},

	onShareAppMessage(options) {
		uni.$emit("page-share", {
			page: this,
			options
		});
	},

	onPageScroll(e) {
		uni.$emit("page-scroll", {
			page: this,
			e
		});
	},

	onResize(e) {
		uni.$emit("page-resize", {
			page: this,
			e
		});
	},
};